package org.jeecg.desen.cretab.service.impl;

import org.jeecg.desen.cretab.service.DesensDatabaseCreateService;
import org.jeecg.desen.cretab.service.DesensHiveCreateTableService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

@Service
public class DesensDatabaseCreateServiceImpl implements DesensDatabaseCreateService {

    @Resource(name = "desensHiveCreateTableByAllServiceImpl")
    DesensHiveCreateTableService desensHiveCreateTableAllService;

    @Resource(name = "desensHiveCreateTableByStatusServiceImpl")
    DesensHiveCreateTableService desensHiveCreateTableByStatusService;


    /**
     * 创建hive库所有表，全量创建
     * 特殊情况使用
     * @return
     */
    @Override
    public boolean createHiveTableAll() {
        return desensHiveCreateTableAllService.createHiveTableForMeta(new Date());
    }

    /**
     * 根据日期当天的状态建表
     * @param date
     * @return
     */
    @Override
    public boolean createHiveTableByStatus(Date date) {
        return desensHiveCreateTableByStatusService.createHiveTableForMeta(date);
    }
}
